package com.ruoyi.file.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * @description: [一句话描述该类的功能]
 * @author: [wangshujun]
 * @createDate: [2020/9/21 15:30]
 * @version: [v1.0]
 */
@Configuration
@RefreshScope
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Value("${local.path}")
    private String fileRootDir;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        System.out.println(">>>>>初始化静态资源文件访问适配<<<<<<<<");
        registry.addResourceHandler("/lookfile/**")
                .addResourceLocations("file:" + fileRootDir);
    }
}
